package lc.链表;

import utils.ListNode;

/**
 * @description:
 * @author: qian
 * @createDate: 2021/10/13
 */
public class 剑指Offer24_反转链表 {

    public ListNode reverseList(ListNode head) {

        ListNode pre = null;
        ListNode next = null;
        while (head != null) {
            next = head.next;
            head.next = pre;
            pre = head;
            head = next;
        }
        return pre;
    }
}
